package com.alesj.newsfeed.bool.impl;

import com.alesj.newsfeed.bool.Operator;
import com.alesj.newsfeed.bool.Token;

/**
 * @author <a href="mailto:ales.justin@gmail.com">Ales Justin</a>
 */
public class OperatorToken<T> implements Token<Operator<T>> {

    private String string;

    public OperatorToken(String string) {
        this.string = string;
    }

    @SuppressWarnings("unchecked")
    public Operator<T> value() {
        return "AND".equalsIgnoreCase(string) ? And.INSTANCE : Or.INSTANCE;
    }

    public String toString() {
        return string;
    }
}
